package com.lyq.util;

import java.io.IOException;
import javax.servlet.jsp.PageContext;

public class PageUtil
{
	public static boolean isClientScriptBlockRegistered(PageContext context, String block)
	{
		boolean registered = false;
		if (context.getAttribute(block) != null)
		{
			registered = true;
		}
		return registered;
	}

	public static void registerClientScriptBlock(PageContext context, String block, String body)
	{
		if (isClientScriptBlockRegistered(context, block))
		{
			return;
		}
		context.setAttribute(block, block);
		try
		{
			context.getOut().println(body);
		}
		catch (IOException ioe)
		{
		}
	}
}
